home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / lzo / lzoconf.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-06-09  |  13.5 KB  |  414 lines

  1. /* lzoconf.h -- configuration for the LZO real-time data compression library
  2.  
  3.    This file is part of the LZO real-time data compression library.
  4.  
  5.    Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
  6.    Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
  7.    Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
  8.    Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
  9.    Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
  10.    Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
  11.    Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
  12.    Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
  13.    Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
  14.    Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
  15.    All Rights Reserved.
  16.  
  17.    The LZO library is free software; you can redistribute it and/or
  18.    modify it under the terms of the GNU General Public License,
  19.    version 2, as published by the Free Software Foundation.
  20.  
  21.    The LZO library is distributed in the hope that it will be useful,
  22.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  23.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  24.    GNU General Public License for more details.
  25.  
  26.    You should have received a copy of the GNU General Public License
  27.    along with the LZO library; see the file COPYING.
  28.    If not, write to the Free Software Foundation, Inc.,
  29.    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  30.  
  31.    Markus F.X.J. Oberhumer
  32.    <markus@oberhumer.com>
  33.    http://www.oberhumer.com/opensource/lzo/
  34.  */
  35.  
  36.  
  37. #ifndef __LZOCONF_H_INCLUDED
  38. #define __LZOCONF_H_INCLUDED
  39.  
  40. #define LZO_VERSION             0x2020
  41. #define LZO_VERSION_STRING      "2.02"
  42. #define LZO_VERSION_DATE        "Oct 17 2005"
  43.  
  44. /* internal Autoconf configuration file - only used when building LZO */
  45. #if defined(LZO_HAVE_CONFIG_H)
  46. #  include <config.h>
  47. #endif
  48. #include <limits.h>
  49. #include <stddef.h>
  50.  
  51.  
  52. /***********************************************************************
  53. // LZO requires a conforming <limits.h>
  54. ************************************************************************/
  55.  
  56. #if !defined(CHAR_BIT) || (CHAR_BIT != 8)
  57. #  error "invalid CHAR_BIT"
  58. #endif
  59. #if !defined(UCHAR_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX)
  60. #  error "check your compiler installation"
  61. #endif
  62. #if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1)
  63. #  error "your limits.h macros are broken"
  64. #endif
  65.  
  66. /* get OS and architecture defines */
  67. #ifndef __LZODEFS_H_INCLUDED
  68. #include "lzodefs.h"
  69. #endif
  70.  
  71.  
  72. #ifdef __cplusplus
  73. extern "C" {
  74. #endif
  75.  
  76.  
  77. /***********************************************************************
  78. // some core defines
  79. ************************************************************************/
  80.  
  81. #if !defined(LZO_UINT32_C)
  82. #  if (UINT_MAX < LZO_0xffffffffL)
  83. #    define LZO_UINT32_C(c)     c ## UL
  84. #  else
  85. #    define LZO_UINT32_C(c)     ((c) + 0U)
  86. #  endif
  87. #endif
  88.  
  89. /* memory checkers */
  90. #if !defined(__LZO_CHECKER)
  91. #  if defined(__BOUNDS_CHECKING_ON)
  92. #    define __LZO_CHECKER       1
  93. #  elif defined(__CHECKER__)
  94. #    define __LZO_CHECKER       1
  95. #  elif defined(__INSURE__)
  96. #    define __LZO_CHECKER       1
  97. #  elif defined(__PURIFY__)
  98. #    define __LZO_CHECKER       1
  99. #  endif
  100. #endif
  101.  
  102.  
  103. /***********************************************************************
  104. // integral and pointer types
  105. ************************************************************************/
  106.  
  107. /* lzo_uint should match size_t */
  108. #if !defined(LZO_UINT_MAX)
  109. #  if defined(LZO_ABI_LLP64) /* WIN64 */
  110. #    if defined(LZO_OS_WIN64)
  111.      typedef unsigned __int64   lzo_uint;
  112.      typedef __int64            lzo_int;
  113. #    else
  114.      typedef unsigned long long lzo_uint;
  115.      typedef long long          lzo_int;
  116. #    endif
  117. #    define LZO_UINT_MAX        0xffffffffffffffffull
  118. #    define LZO_INT_MAX         9223372036854775807LL
  119. #    define LZO_INT_MIN         (-1LL - LZO_INT_MAX)
  120. #  elif defined(LZO_ABI_IP32L64) /* MIPS R5900 */
  121.      typedef unsigned int       lzo_uint;
  122.      typedef int                lzo_int;
  123. #    define LZO_UINT_MAX        UINT_MAX
  124. #    define LZO_INT_MAX         INT_MAX
  125. #    define LZO_INT_MIN         INT_MIN
  126. #  elif (ULONG_MAX >= LZO_0xffffffffL)
  127.      typedef unsigned long      lzo_uint;
  128.      typedef long               lzo_int;
  129. #    define LZO_UINT_MAX        ULONG_MAX
  130. #    define LZO_INT_MAX         LONG_MAX
  131. #    define LZO_INT_MIN         LONG_MIN
  132. #  else
  133. #    error "lzo_uint"
  134. #  endif
  135. #endif
  136.  
  137. /* Integral types with 32 bits or more. */
  138. #if !defined(LZO_UINT32_MAX)
  139. #  if (UINT_MAX >= LZO_0xffffffffL)
  140.      typedef unsigned int       lzo_uint32;
  141.      typedef int                lzo_int32;
  142. #    define LZO_UINT32_MAX      UINT_MAX
  143. #    define LZO_INT32_MAX       INT_MAX
  144. #    define LZO_INT32_MIN       INT_MIN
  145. #  elif (ULONG_MAX >= LZO_0xffffffffL)
  146.      typedef unsigned long      lzo_uint32;
  147.      typedef long               lzo_int32;
  148. #    define LZO_UINT32_MAX      ULONG_MAX
  149. #    define LZO_INT32_MAX       LONG_MAX
  150. #    define LZO_INT32_MIN       LONG_MIN
  151. #  else
  152. #    error "lzo_uint32"
  153. #  endif
  154. #endif
  155.  
  156. /* The larger type of lzo_uint and lzo_uint32. */
  157. #if (LZO_UINT_MAX >= LZO_UINT32_MAX)
  158. #  define lzo_xint              lzo_uint
  159. #else
  160. #  define lzo_xint              lzo_uint32
  161. #endif
  162.  
  163. /* Memory model that allows to access memory at offsets of lzo_uint. */
  164. #if !defined(__LZO_MMODEL)
  165. #  if (LZO_UINT_MAX <= UINT_MAX)
  166. #    define __LZO_MMODEL
  167. #  elif defined(LZO_HAVE_MM_HUGE_PTR)
  168. #    define __LZO_MMODEL_HUGE   1
  169. #    define __LZO_MMODEL        __huge
  170. #  else
  171. #    define __LZO_MMODEL
  172. #  endif
  173. #endif
  174.  
  175. /* no typedef here because of const-pointer issues */
  176. #define lzo_bytep               unsigned char __LZO_MMODEL *
  177. #define lzo_charp               char __LZO_MMODEL *
  178. #define lzo_voidp               void __LZO_MMODEL *
  179. #define lzo_shortp              short __LZO_MMODEL *
  180. #define lzo_ushortp             unsigned short __LZO_MMODEL *
  181. #define lzo_uint32p             lzo_uint32 __LZO_MMODEL *
  182. #define lzo_int32p              lzo_int32 __LZO_MMODEL *
  183. #define lzo_uintp               lzo_uint __LZO_MMODEL *
  184. #define lzo_intp                lzo_int __LZO_MMODEL *
  185. #define lzo_xintp               lzo_xint __LZO_MMODEL *
  186. #define lzo_voidpp              lzo_voidp __LZO_MMODEL *
  187. #define lzo_bytepp              lzo_bytep __LZO_MMODEL *
  188. /* deprecated - use `lzo_bytep' instead of `lzo_byte *' */
  189. #define lzo_byte                unsigned char __LZO_MMODEL
  190.  
  191. typedef int lzo_bool;
  192.  
  193.  
  194. /***********************************************************************
  195. // function types
  196. ************************************************************************/
  197.  
  198. /* name mangling */
  199. #if !defined(__LZO_EXTERN_C)
  200. #  ifdef __cplusplus
  201. #    define __LZO_EXTERN_C      extern "C"
  202. #  else
  203. #    define __LZO_EXTERN_C      extern
  204. #  endif
  205. #endif
  206.  
  207. /* calling convention */
  208. #if !defined(__LZO_CDECL)
  209. #  define __LZO_CDECL           __lzo_cdecl
  210. #endif
  211.  
  212. /* DLL export information */
  213. #if !defined(__LZO_EXPORT1)
  214. #  define __LZO_EXPORT1
  215. #endif
  216. #if !defined(__LZO_EXPORT2)
  217. #  define __LZO_EXPORT2
  218. #endif
  219.  
  220. /* __cdecl calling convention for public C and assembly functions */
  221. #if !defined(LZO_PUBLIC)
  222. #  define LZO_PUBLIC(_rettype)  __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL
  223. #endif
  224. #if !defined(LZO_EXTERN)
  225. #  define LZO_EXTERN(_rettype)  __LZO_EXTERN_C LZO_PUBLIC(_rettype)
  226. #endif
  227. #if !defined(LZO_PRIVATE)
  228. #  define LZO_PRIVATE(_rettype) static _rettype __LZO_CDECL
  229. #endif
  230.  
  231. /* function types */
  232. typedef int
  233. (__LZO_CDECL *lzo_compress_t)   ( const lzo_bytep src, lzo_uint  src_len,
  234.                                         lzo_bytep dst, lzo_uintp dst_len,
  235.                                         lzo_voidp wrkmem );
  236.  
  237. typedef int
  238. (__LZO_CDECL *lzo_decompress_t) ( const lzo_bytep src, lzo_uint  src_len,
  239.                                         lzo_bytep dst, lzo_uintp dst_len,
  240.                                         lzo_voidp wrkmem );
  241.  
  242. typedef int
  243. (__LZO_CDECL *lzo_optimize_t)   (       lzo_bytep src, lzo_uint  src_len,
  244.                                         lzo_bytep dst, lzo_uintp dst_len,
  245.                                         lzo_voidp wrkmem );
  246.  
  247. typedef int
  248. (__LZO_CDECL *lzo_compress_dict_t)(const lzo_bytep src, lzo_uint  src_len,
  249.                                          lzo_bytep dst, lzo_uintp dst_len,
  250.                                          lzo_voidp wrkmem,
  251.                                    const lzo_bytep dict, lzo_uint dict_len );
  252.  
  253. typedef int
  254. (__LZO_CDECL *lzo_decompress_dict_t)(const lzo_bytep src, lzo_uint  src_len,
  255.                                            lzo_bytep dst, lzo_uintp dst_len,
  256.                                            lzo_voidp wrkmem,
  257.                                      const lzo_bytep dict, lzo_uint dict_len );
  258.  
  259.  
  260. /* Callback interface. Currently only the progress indicator ("nprogress")
  261.  * is used, but this may change in a future release. */
  262.  
  263. struct lzo_callback_t;
  264. typedef struct lzo_callback_t lzo_callback_t;
  265. #define lzo_callback_p lzo_callback_t __LZO_MMODEL *
  266.  
  267. /* malloc & free function types */
  268. typedef lzo_voidp (__LZO_CDECL *lzo_alloc_func_t)
  269.     (lzo_callback_p self, lzo_uint items, lzo_uint size);
  270. typedef void      (__LZO_CDECL *lzo_free_func_t)
  271.     (lzo_callback_p self, lzo_voidp ptr);
  272.  
  273. /* a progress indicator callback function */
  274. typedef void (__LZO_CDECL *lzo_progress_func_t)
  275.     (lzo_callback_p, lzo_uint, lzo_uint, int);
  276.  
  277. struct lzo_callback_t
  278. {
  279.     /* custom allocators (set to 0 to disable) */
  280.     lzo_alloc_func_t nalloc;                /* [not used right now] */
  281.     lzo_free_func_t nfree;                  /* [not used right now] */
  282.  
  283.     /* a progress indicator callback function (set to 0 to disable) */
  284.     lzo_progress_func_t nprogress;
  285.  
  286.     /* NOTE: the first parameter "self" of the nalloc/nfree/nprogress
  287.      * callbacks points back to this struct, so you are free to store
  288.      * some extra info in the following variables. */
  289.     lzo_voidp user1;
  290.     lzo_xint user2;
  291.     lzo_xint user3;
  292. };
  293.  
  294.  
  295. /***********************************************************************
  296. // error codes and prototypes
  297. ************************************************************************/
  298.  
  299. /* Error codes for the compression/decompression functions. Negative
  300.  * values are errors, positive values will be used for special but
  301.  * normal events.
  302.  */
  303. #define LZO_E_OK                    0
  304. #define LZO_E_ERROR                 (-1)
  305. #define LZO_E_OUT_OF_MEMORY         (-2)    /* [not used right now] */
  306. #define LZO_E_NOT_COMPRESSIBLE      (-3)    /* [not used right now] */
  307. #define LZO_E_INPUT_OVERRUN         (-4)
  308. #define LZO_E_OUTPUT_OVERRUN        (-5)
  309. #define LZO_E_LOOKBEHIND_OVERRUN    (-6)
  310. #define LZO_E_EOF_NOT_FOUND         (-7)
  311. #define LZO_E_INPUT_NOT_CONSUMED    (-8)
  312. #define LZO_E_NOT_YET_IMPLEMENTED   (-9)    /* [not used right now] */
  313.  
  314.  
  315. #ifndef lzo_sizeof_dict_t
  316. #  define lzo_sizeof_dict_t     ((unsigned)sizeof(lzo_bytep))
  317. #endif
  318.  
  319. /* lzo_init() should be the first function you call.
  320.  * Check the return code !
  321.  *
  322.  * lzo_init() is a macro to allow checking that the library and the
  323.  * compiler's view of various types are consistent.
  324.  */
  325. #define lzo_init() __lzo_init_v2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\
  326.     (int)sizeof(long),(int)sizeof(lzo_uint32),(int)sizeof(lzo_uint),\
  327.     (int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\
  328.     (int)sizeof(lzo_callback_t))
  329. LZO_EXTERN(int) __lzo_init_v2(unsigned,int,int,int,int,int,int,int,int,int);
  330.  
  331. /* version functions (useful for shared libraries) */
  332. LZO_EXTERN(unsigned) lzo_version(void);
  333. LZO_EXTERN(const char *) lzo_version_string(void);
  334. LZO_EXTERN(const char *) lzo_version_date(void);
  335. LZO_EXTERN(const lzo_charp) _lzo_version_string(void);
  336. LZO_EXTERN(const lzo_charp) _lzo_version_date(void);
  337.  
  338. /* string functions */
  339. LZO_EXTERN(int)
  340. lzo_memcmp(const lzo_voidp _s1, const lzo_voidp _s2, lzo_uint _len);
  341. LZO_EXTERN(lzo_voidp)
  342. lzo_memcpy(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len);
  343. LZO_EXTERN(lzo_voidp)
  344. lzo_memmove(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len);
  345. LZO_EXTERN(lzo_voidp)
  346. lzo_memset(lzo_voidp _s, int _c, lzo_uint _len);
  347.  
  348. /* checksum functions */
  349. LZO_EXTERN(lzo_uint32)
  350. lzo_adler32(lzo_uint32 _adler, const lzo_bytep _buf, lzo_uint _len);
  351. LZO_EXTERN(lzo_uint32)
  352. lzo_crc32(lzo_uint32 _c, const lzo_bytep _buf, lzo_uint _len);
  353. LZO_EXTERN(const lzo_uint32p)
  354. lzo_get_crc32_table(void);
  355.  
  356. /* misc. */
  357. LZO_EXTERN(int) _lzo_config_check(void);
  358. typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u;
  359. typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u;
  360. typedef union { void *vp; lzo_bytep bp; lzo_uint32 u32; long l; } lzo_align_t;
  361.  
  362. /* align a char pointer on a boundary that is a multiple of `size' */
  363. LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp _ptr, lzo_uint _size);
  364. #define LZO_PTR_ALIGN_UP(_ptr,_size) \
  365.     ((_ptr) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(_ptr),(lzo_uint)(_size)))
  366.  
  367.  
  368. /***********************************************************************
  369. // deprecated macros - only for backward compatibility with LZO v1.xx
  370. ************************************************************************/
  371.  
  372. #if defined(LZO_CFG_COMPAT)
  373.  
  374. #define __LZOCONF_H 1
  375.  
  376. #if defined(LZO_ARCH_I086)
  377. #  define __LZO_i386 1
  378. #elif defined(LZO_ARCH_I386)
  379. #  define __LZO_i386 1
  380. #endif
  381.  
  382. #if defined(LZO_OS_DOS16)
  383. #  define __LZO_DOS 1
  384. #  define __LZO_DOS16 1
  385. #elif defined(LZO_OS_DOS32)
  386. #  define __LZO_DOS 1
  387. #elif defined(LZO_OS_WIN16)
  388. #  define __LZO_WIN 1
  389. #  define __LZO_WIN16 1
  390. #elif defined(LZO_OS_WIN32)
  391. #  define __LZO_WIN 1
  392. #endif
  393.  
  394. #define __LZO_CMODEL
  395. #define __LZO_DMODEL
  396. #define __LZO_ENTRY             __LZO_CDECL
  397. #define LZO_EXTERN_CDECL        LZO_EXTERN
  398. #define LZO_ALIGN               LZO_PTR_ALIGN_UP
  399.  
  400. #define lzo_compress_asm_t      lzo_compress_t
  401. #define lzo_decompress_asm_t    lzo_decompress_t
  402.  
  403. #endif /* LZO_CFG_COMPAT */
  404.  
  405.  
  406. #ifdef __cplusplus
  407. } /* extern "C" */
  408. #endif
  409.  
  410. #endif /* already included */
  411.  
  412.  
  413. /* vim:set ts=4 et: */
  414.